<?php

namespace App\Observers;

use App\Exceptions\ApiException;
use App\Models\SysConfig;

class SysConfigObserver
{
    public function creating(SysConfig $sysConfig)
    {
        $sys=SysConfig::where('key',$sysConfig['key'])->first();
        if ($sys)
            throw new ApiException("键值重复");
        return $sysConfig;
    }


}
